package com.whut.customer.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 菜单表
 * </p>
 *
 * @author author
 * @since 2021-01-23
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sys_menu")
@ApiModel(value="SysMenu对象", description="菜单表")
public class SysMenu implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键")
    @TableId(value = "id", type = IdType.ID_WORKER)
    private Long id;

    @ApiModelProperty(value = "菜单地址")
    @TableField("menu_url")
    private String menuUrl;

    @ApiModelProperty(value = "菜单名称")
    @TableField("menu_name")
    private String menuName;

    @ApiModelProperty(value = "菜单编号")
    @TableField("menu_code")
    private String menuCode;

    @ApiModelProperty(value = "菜单父级ID")
    @TableField("menu_parent_id")
    private Long menuParentId;

    @ApiModelProperty(value = "授权码")
    @TableField("permissions")
    private String permissions;

    @ApiModelProperty(value = "菜单排序")
    @TableField("menu_sort")
    private Integer menuSort;

    @ApiModelProperty(value = "菜单图标")
    @TableField("menu_ico")
    private String menuIco;

    @ApiModelProperty(value = "菜单打开位置")
    @TableField("targets")
    private String targets;

    @ApiModelProperty(value = "创建时间")
    @TableField(value = "create_date", fill = FieldFill.INSERT)
    private LocalDateTime createDate;

    @ApiModelProperty(value = "创建人ID")
    @TableField("create_user_id")
    private Long createUserId;

    @ApiModelProperty(value = "修改时间")
    @TableField(value = "update_date", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateDate;

    @ApiModelProperty(value = "更新人ID")
    @TableField("update_user_id")
    private Long updateUserId;

    @ApiModelProperty(value = "是否删除 0-正常 1-已删除")
    @TableField("del_flag")
    @TableLogic
    private Integer delFlag;

    /**
     * 子节点
     */
    @TableField(exist = false)
    private List<SysMenu> children;

    /**
     * 要删除的子节点
     */
    @TableField(exist = false)
    private List<SysMenu> removeMenu = new ArrayList<>(0);

}
